package org.xinjiang.data.migration.flush.enums;

import lombok.Getter;

/**
 * 学历
 */
@Getter
public enum EducationalLevelEnum {
    ILLITERACY("", "文盲", "1", null),
    PRIMARY_SCHOOL("", "小学", "2", null),
    MIDDLE_SCHOOL("", "初中", "3", null),
    BACHELOR("", "高中", "4", null),
    JUNIOR_COLLEGE("", "大专", "5", null),
    UNDERGRADUATE_COURSE("", "本科", "6", null),
    MASTER("", "硕士", "7", null),
    DR("", "硕士及以上（包含博士）", "8", null),
    POLYTECHNIC_SCHOOL("", "中专和中技", "9", null),
    UNKNOWN("UNKNOWN", "其他", "10", null);

    /**
     * 数据来源code
     */
    private String sourceCode;

    /**
     * 数据来源名成
     */
    private String sourceName;


    private String targetCode;

    private Integer id;

    EducationalLevelEnum(String sourceCode, String sourceName, String targetCode, Integer id) {
        this.sourceCode = sourceCode;
        this.sourceName = sourceName;
        this.targetCode = targetCode;
        this.id = id;
    }

    public static EducationalLevelEnum toCode(String sourceCode) {
        for (EducationalLevelEnum value : EducationalLevelEnum.values()) {
            if (value.sourceCode.equals(sourceCode)) {
                return value;
            }
        }
        return UNKNOWN;
    }
}
